<template>
	<view>
		<navBarView></navBarView>
		<navBar navBarTitle='师资详情' bg='#f0f2f5' @rightIconChange="openPopup"></navBar>
		<view class="content">
			<image :src="obj.hdetailimg" class="img"></image>
			<view class="txt">
				{{obj.name}}
			</view>
			<view class="content-s">
				{{obj.synopsis}}
			</view>
			<view class="btn-submit" @click="openPopup">立即预约</view>
		</view>
		<sumitPopup ref="submitPopupRef" :classifyArr='courseLst' @submitPopupChange='submitPopupChange'></sumitPopup>
	</view>
</template>

<script>
	import navBarView from '../../components/navBarView/navBarView.vue'
	export default {
		components: {
			navBarView
		},
		data() {
			return {
				obj: {},
				courseLst: []
			}
		},
		onLoad() {
			this.obj = uni.getStorageSync('teacherItem')

		},
		onShow() {
			this.courseLst = uni.getStorageSync('courseLst')
		},
		methods: {
			openPopup() {
				this.$refs.submitPopupRef.openPopup()
			},
			submitPopupChange(data) {
				uni.showLoading({
					title: '提交中'
				})
				this.$http('common.addSubmit', {
					...data,
					adminId: uni.getStorageSync('adminId')
				}).then(res => {
					if (res.code == 200) {
						this.$tools.showMsg('提交成功')
						uni.hideLoading()
						this.$refs.submitPopupRef.clearParam()
						this.$refs.submitPopupRef.closePopup()
					}
				})
			},
		}
	}
</script>

<style>
	page {
		background: #f0f2f5;
	}
</style>
<style lang="scss">
	.content {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
	}

	.img {
		width: 148rpx;
		height: 148rpx;
		border-radius: 50%;
		margin-top: 32rpx;
		background: skyblue;
	}

	.txt {
		margin-top: 32rpx;
		font-size: 36rpx;
		color: #2F2525;
		font-weight: bold;
	}

	.content-s {
		margin-top: 16rpx;
		line-height: 1.5em;
		margin-left: 32rpx;
		margin-right: 32rpx;
		font-weight: 500;
		font-size: 28rpx;
		color: #4F4F4F;
	}

	.btn-submit {
		margin-left: 32rpx;
		margin-right: 32rpx;
		margin-top: 174rpx;
		height: 88rpx;
		line-height: 88rpx;
		text-align: center;
		background: #209E9A;
		border-radius: 56rpx;
		font-weight: 500;
		font-size: 36rpx;
		color: #FFFFFF;
		width: 686rpx;
	}
</style>